package com.ie.common;


import com.google.code.kaptcha.Producer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Service;

import java.awt.image.BufferedImage;

@Configuration
public class KaptchaServiceUtils {

    @Autowired
    private Producer producer;

    /**
     * 生成随机验证码
     *
     * @return
     */
    public String createCaptchaText() {
        return producer.createText();
    }


    public BufferedImage createCaptchaImage(String captchaText) {
        return producer.createImage(captchaText);//图像验证码;
    }


}
